<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/20 0020
  Time: 8:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
</head>
<body>
<form id="form">
    <h5 id="checkUser"><c:out value="${sessionScope.name}"></c:out></h5>
    用户名:<input type="text" name="username" required><br/>
    密码:<input type="text" name="password" required><br/>
    <input type="button" onclick="sub()" value="登录">
    <input type="button" onclick="Register()" value="注册">
</form>

<script src="../js/jquery-1.8.3.min.js"></script>
<script>
    function sub() {
        var data=$("#form").serialize();
        $.getJSON(
            "/LoginServlet", data,function(result){
                if(result>0){
                    alert("可以登录:"+result)
                }
            }
        )
    }
    function Register(){
        window.location.href="/App/Register.jsp";
    }
</script>
</body>
</html>
